package com.backend.config;


public class Result<T> {
    Integer code;
    String msg;
    T data;

    /**
     * 成功
     */
    public static Result success(String message,Object data){
        return  new Result(200,message,data);
    }
    public static Result success(Integer code,String message,Object data){
        Result result = new Result(code, message, data);
        return result;
    }

    /**
     * 失败
     */
    public static Result fail(String message,Object data){
        return  new Result(500,message,data);
    }
    public static Result fail(Integer code, String message,Object data){
        return  new Result(code,message,data);
    }




    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public Result(){};
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
